#include<iostream>
#include<vector>
using namespace std;

class Solution {
public:
	int removeDuplicates(vector<int>& nums) {	
		int start, end;
		for (start= 0; start < nums.size() - 1; start++) {
			for (end = start + 1; end < nums.size();) {
				if (nums[start] == nums[end]) {
					if (end < nums.size() - 1) 
						end++;
					else break;
				}					
				else {
					end--;
					break;
				}
			}
			if (start != end)
				nums.erase(nums.begin() + start, nums.begin() + end);
		}
		return nums.size();
	}
};

void main() {
	Solution s;
	vector<int> arr = { 1,1,2 };
	cout << s.removeDuplicates(arr) << endl;
}